package com.game.majiang.logic;

import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;

import com.game.majiang.vo.ActivityVo;

public class ActivityManger {
	
	public static ActivityManger  Instance;
	
	public static ActivityManger getInstance() {
		if (Instance==null) {
			Instance = new ActivityManger();
		}
		return Instance;
	}
	public HashMap<Integer, Activity> allactivity=new HashMap<Integer, Activity>();//所有活动
	
	public void init() {
		allactivity.clear();
		for(Activity item : ActivityVo.getAllactivityList()) {
			allactivity.put(item.id, item);
		}
		
		
	}
	/**
	 * 玩家登录发送活动
	 */
	public  void SendActivityRsp(LogicClient client){
		
	}
	/**
	 * 获取当前时间是本周第几天
	 * @param date
	 * @return
	 */
	public static int dayofWeekDay(Date date) {
		Calendar cal=Calendar.getInstance();
		cal.setTime((Date) date);
		int w=cal.get(Calendar.DAY_OF_WEEK)-1;
		if(w<0) {
			w=0;
		}else if (w==0) {
			w=7;
		}
		return w;
	}
	
}
